package com.yueqian.sign;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yueqian.sign.model.Classes;
import com.yueqian.sign.model.Student;

import java.util.List;

public class StudentAdapter extends MyAdapter<Student> implements MyAdapter.AdapterListener {

    public StudentAdapter(Context context, List<Student> list) {
        super(context, list);
        setAdapterListener(this);
    }

    @Override
    public View bind(int position, View convertView, ViewGroup parent) {
        //Log.i("ClassesAdapter1", convertView.toString());
        if(convertView == null) {
            setContentView(R.layout.item_view_sign_list);
            //Log.i("ClassesAdapter2", convertView.toString());
        }
        //Log.i("ClassesAdapter3", convertView.toString());
        item = list.get(position);//不推荐把变量的定义写在循环中
        TextView tv_number = convertView.findViewById(R.id.tv_number);
        TextView tv_name = convertView.findViewById(R.id.tv_name);
        tv_number.setText(item.getNumber());
        tv_name.setText(item.getName());

        return convertView;
    }
}
